package com.cyq.day07;

import java.util.Scanner;

public class Demo01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int minNumber = sc.nextInt();
        int maxNumber=sc.nextInt();
        int addNmunber=sc.nextInt();
        int sum=addMath(minNumber,maxNumber,addNmunber);
        System.out.println(sum);
    }

    public static int addMath(int minNumber,int maxNumber,int addNumber) {
        int sum = 0;
        for (int i = minNumber; i <= maxNumber; i+=addNumber) {
            sum += i;
        }
        //sum = (1 + number) * (number) / 2;
        return sum;

    }
}
